#include <cstdio>

#define IMPOSSIBLE "impossible"


int main ()
{
	int test_cases, s, d;

	scanf ("%d", &test_cases);

	while (test_cases--)
	{
		scanf ("%d %d", &s, &d);
		s += d;
		if (s % 2) {
			puts (IMPOSSIBLE);
			continue;
		}
		s /= 2;
		d = s - d;
		if (d < 0)
			puts (IMPOSSIBLE);
		else
			printf ("%d %d\n", s, d);
	}
}